package homework00105;

import java.net.StandardSocketOptions;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Set;

public class DouDiZhu {

	public static void main(String[] args) {
		HashMap<Integer,String> map=new HashMap();
		ArrayList<Integer> poker = new ArrayList<Integer>();
		String[] colors={"♠","♣","♥","♦"}; 
		String[] numbers={"2","A","K","Q","J","10","9","8","7","6","5","4","3"};
		int count = 0;
		map.put(count++, "大王");
		map.put(count++, "小王");
		for(String number:numbers){
			for(String color:colors){
				map.put(count++, color+number);
			}
		}
		Set<Integer> numberSet = map.keySet();
		  poker.addAll(numberSet);
		//洗牌
		Collections.shuffle(poker);
		Player playe1=new Player("老王");
		Player playe2=new Player("老李");
		Player playe3=new Player("老刘");
		Player playe4=new Player("底牌");
		for(int i=0;i<poker.size();i++){
			int now = poker.get(i);
			if(i<51){
				if(i%3==0){
					playe1.getList1().add(now);
				}else if(i%3==1){
					playe2.getList1().add(now);
				}else{
					playe3.getList1().add(now);
				}
			}else{
				playe4.getList1().add(now);
			}
		}
		Collections.sort(playe1.getList1());
		Collections.sort(playe2.getList1());
		Collections.sort(playe3.getList1());
		Collections.sort(playe4.getList1());
		
		//转换
		for (int i : playe1.getList1()) {
			   String card = map.get(i);
			   playe1.getList().add(card);
		}
		for (int i : playe2.getList1()) {
			   String card = map.get(i);
			   playe2.getList().add(card);
		}
		for (int i : playe3.getList1()) {
			   String card = map.get(i);
			   playe3.getList().add(card);
		}
		for (int i : playe4.getList1()) {
			   String card = map.get(i);
			   playe4.getList().add(card);
		}
		System.out.println("老王：" + playe1.getList());
		System.out.println("老李：" + playe2.getList());
		System.out.println("老刘：" + playe3.getList());
		System.out.println("底牌：" + playe4.getList());
	}

}
